# -*- python -*-
# ex: set syntax=python:

# This is a sample buildmaster config file. It must be installed as
# 'master.cfg' in your buildmaster's base directory (although the filename
# can be changed with the --basedir option to 'mktap buildbot master').

# It has one job: define a dictionary named BuildmasterConfig. This
# dictionary has a variety of keys to control different aspects of the
# buildmaster. They are documented in docs/config.xhtml .

import os.path
#from buildbot.changes.freshcvs import FreshCVSSource
from buildbot.scheduler import Scheduler, Periodic
from buildbot.process import buildstep, factory
from buildbot.status import html
from buildbot.buildslave import BuildSlave
from buildbot.changes.pb import PBChangeSource
from buildbot.scheduler import Scheduler, Periodic
from buildbot.process import buildstep
from buildbot.steps.shell import ShellCommand
from buildbot.steps.source import SVN
from buildbot.status import html
s = factory.s
c = BuildmasterConfig = {}

####### BUILDSLAVES
c['slaves'] = [BuildSlave("bot1name", "bot1passwd")]
c['slavePortnum'] = 9989

c['change_source'] = PBChangeSource()

####### SCHEDULING

periodic = Periodic("every_6_hours", ["sugarbot_trunk"], 6*60*60)
# periodic = Periodic("every_30_minutes", ["sugarbot_trunk"], 30*60)
c['schedulers'] = [periodic]

####### SVN
source = s(SVN, mode='update',
baseURL='http://sugarbot.googlecode.com/svn/', 
defaultBranch='trunk/sugarbot')

####### NOSE
class NoseTest(ShellCommand):
    name = "nose tests"
    description = ["running nose tests"]
    descriptionDone = [name]

nose_tests = s(NoseTest, command="/usr/bin/nosetests")

###### SUGARBOT
class SugarbotTest(ShellCommand):
    name = "sugarbot tests"
    description = ["running sugarbot tests"]
    description = [name]
sugarbot_tests = s(SugarbotTest, command="/usr/bin/env python sugarbotlauncher.py")

####### BUILDFACTORY
f = factory.BuildFactory([source,nose_tests,sugarbot_tests])

c['builders'] = [
{'name':'sugarbot_trunk',
'slavename':'sugarbot',
'builddir':'test-APP-linux',
'factory':f },
]

c['status'] = []

####### STATUS
c['status'].append(html.WebStatus(http_port=8010))

####### PROJECT INFO
c['projectName'] = "sugarbot"
c['projectURL'] = "http://code.google.com/p/sugarbot/"
c['buildbotURL'] = "http://localhost:8010/"
c['bots']=[("sugarbot","password")]
